<template>
  <div :id="chartsId" :style="{width: '700px', height: '300px'}" class="my-chart"></div>
</template>

<script>
export default {
  props:["chartsId", "keyName", "data"],
  name: 'sales',
  data(){
      return {
      }
  },
  mounted(){
      this.drawLine();
  },
  methods: {
      drawLine(){
          let myChart = this.$echarts.init(document.getElementById(this.chartsId));
          myChart.setOption({
            title: { text: this.childMsg },
            tooltip: {},
            xAxis: {
                data: this.keyName
            },
            yAxis: {},
            series: [{
                name: '销量',
                type: 'bar',
                data: this.data
            }]
        });
      }
  }
}
</script>